/*
 *  si-83-seccertificate-sighashalg.c
 *  Security
 *
 *  Copyright (c) 2015 Apple Inc. All Rights Reserved.
 *
 */

#include <CoreFoundation/CoreFoundation.h>
#include <Security/SecCertificate.h>
#include <Security/SecCertificatePriv.h>
#include <utilities/SecCFWrappers.h>
#include <stdlib.h>
#include <unistd.h>

#include "shared_regressions.h"

/* prototypes */
int si_83_seccertificate_sighashalg(int argc, char *const *argv);

/* test certs */
static const UInt8 RSA_MD2[]={
    0x30,0x82,0x02,0x3D,0x30,0x82,0x01,0xA6,0x02,0x11,0x00,0xCD,0xBA,0x7F,0x56,0xF0,
    0xDF,0xE4,0xBC,0x54,0xFE,0x22,0xAC,0xB3,0x72,0xAA,0x55,0x30,0x0D,0x06,0x09,0x2A,
    0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,
    0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,
    0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,
    0x63,0x2E,0x31,0x37,0x30,0x35,0x06,0x03,0x55,0x04,0x0B,0x13,0x2E,0x43,0x6C,0x61,
    0x73,0x73,0x20,0x31,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x50,0x72,0x69,0x6D,
    0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,
    0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,
    0x36,0x30,0x31,0x32,0x39,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32,0x38,
    0x30,0x38,0x30,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x5F,0x31,0x0B,0x30,
    0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,
    0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,
    0x6E,0x63,0x2E,0x31,0x37,0x30,0x35,0x06,0x03,0x55,0x04,0x0B,0x13,0x2E,0x43,0x6C,
    0x61,0x73,0x73,0x20,0x31,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x50,0x72,0x69,
    0x6D,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,
    0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x81,0x9F,0x30,
    0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,
    0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xE5,0x19,0xBF,0x6D,0xA3,0x56,0x61,
    0x2D,0x99,0x48,0x71,0xF6,0x67,0xDE,0xB9,0x8D,0xEB,0xB7,0x9E,0x86,0x80,0x0A,0x91,
    0x0E,0xFA,0x38,0x25,0xAF,0x46,0x88,0x82,0xE5,0x73,0xA8,0xA0,0x9B,0x24,0x5D,0x0D,
    0x1F,0xCC,0x65,0x6E,0x0C,0xB0,0xD0,0x56,0x84,0x18,0x87,0x9A,0x06,0x9B,0x10,0xA1,
    0x73,0xDF,0xB4,0x58,0x39,0x6B,0x6E,0xC1,0xF6,0x15,0xD5,0xA8,0xA8,0x3F,0xAA,0x12,
    0x06,0x8D,0x31,0xAC,0x7F,0xB0,0x34,0xD7,0x8F,0x34,0x67,0x88,0x09,0xCD,0x14,0x11,
    0xE2,0x4E,0x45,0x56,0x69,0x1F,0x78,0x02,0x80,0xDA,0xDC,0x47,0x91,0x29,0xBB,0x36,
    0xC9,0x63,0x5C,0xC5,0xE0,0xD7,0x2D,0x87,0x7B,0xA1,0xB7,0x32,0xB0,0x7B,0x30,0xBA,
    0x2A,0x2F,0x31,0xAA,0xEE,0xA3,0x67,0xDA,0xDB,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,
    0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x03,0x81,0x81,
    0x00,0x4C,0x3F,0xB8,0x8B,0xC6,0x68,0xDF,0xEE,0x43,0x33,0x0E,0x5D,0xE9,0xA6,0xCB,
    0x07,0x84,0x4D,0x7A,0x33,0xFF,0x92,0x1B,0xF4,0x36,0xAD,0xD8,0x95,0x22,0x36,0x68,
    0x11,0x6C,0x7C,0x42,0xCC,0xF3,0x9C,0x2E,0xC4,0x07,0x3F,0x14,0xB0,0x0F,0x4F,0xFF,
    0x90,0x92,0x76,0xF9,0xE2,0xBC,0x4A,0xE9,0x8F,0xCD,0xA0,0x80,0x0A,0xF7,0xC5,0x29,
    0xF1,0x82,0x22,0x5D,0xB8,0xB1,0xDD,0x81,0x23,0xA3,0x7B,0x25,0x15,0x46,0x30,0x79,
    0x16,0xF8,0xEA,0x05,0x4B,0x94,0x7F,0x1D,0xC2,0x1C,0xC8,0xE3,0xB7,0xF4,0x10,0x40,
    0x3C,0x13,0xC3,0x5F,0x1F,0x53,0xE8,0x48,0xE4,0x86,0xB4,0x7B,0xA1,0x35,0xB0,0x7B,
    0x25,0xBA,0xB8,0xD3,0x8E,0xAB,0x3F,0x38,0x9D,0x00,0x34,0x00,0x98,0xF3,0xD1,0x71,
    0x94,
};

static const UInt8 RSA_MD5[]={
    0x30,0x82,0x02,0x5A,0x30,0x82,0x01,0xC3,0x02,0x02,0x01,0xA5,0x30,0x0D,0x06,0x09,
    0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x75,0x31,0x0B,0x30,
    0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,
    0x55,0x04,0x0A,0x13,0x0F,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,
    0x74,0x69,0x6F,0x6E,0x31,0x27,0x30,0x25,0x06,0x03,0x55,0x04,0x0B,0x13,0x1E,0x47,
    0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x53,0x6F,
    0x6C,0x75,0x74,0x69,0x6F,0x6E,0x73,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x23,0x30,
    0x21,0x06,0x03,0x55,0x04,0x03,0x13,0x1A,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,
    0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x20,0x52,0x6F,
    0x6F,0x74,0x30,0x1E,0x17,0x0D,0x39,0x38,0x30,0x38,0x31,0x33,0x30,0x30,0x32,0x39,
    0x30,0x30,0x5A,0x17,0x0D,0x31,0x38,0x30,0x38,0x31,0x33,0x32,0x33,0x35,0x39,0x30,
    0x30,0x5A,0x30,0x75,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,
    0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x47,0x54,0x45,0x20,
    0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x27,0x30,0x25,0x06,
    0x03,0x55,0x04,0x0B,0x13,0x1E,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,
    0x72,0x75,0x73,0x74,0x20,0x53,0x6F,0x6C,0x75,0x74,0x69,0x6F,0x6E,0x73,0x2C,0x20,
    0x49,0x6E,0x63,0x2E,0x31,0x23,0x30,0x21,0x06,0x03,0x55,0x04,0x03,0x13,0x1A,0x47,
    0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x47,0x6C,
    0x6F,0x62,0x61,0x6C,0x20,0x52,0x6F,0x6F,0x74,0x30,0x81,0x9F,0x30,0x0D,0x06,0x09,
    0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8D,0x00,0x30,
    0x81,0x89,0x02,0x81,0x81,0x00,0x95,0x0F,0xA0,0xB6,0xF0,0x50,0x9C,0xE8,0x7A,0xC7,
    0x88,0xCD,0xDD,0x17,0x0E,0x2E,0xB0,0x94,0xD0,0x1B,0x3D,0x0E,0xF6,0x94,0xC0,0x8A,
    0x94,0xC7,0x06,0xC8,0x90,0x97,0xC8,0xB8,0x64,0x1A,0x7A,0x7E,0x6C,0x3C,0x53,0xE1,
    0x37,0x28,0x73,0x60,0x7F,0xB2,0x97,0x53,0x07,0x9F,0x53,0xF9,0x6D,0x58,0x94,0xD2,
    0xAF,0x8D,0x6D,0x88,0x67,0x80,0xE6,0xED,0xB2,0x95,0xCF,0x72,0x31,0xCA,0xA5,0x1C,
    0x72,0xBA,0x5C,0x02,0xE7,0x64,0x42,0xE7,0xF9,0xA9,0x2C,0xD6,0x3A,0x0D,0xAC,0x8D,
    0x42,0xAA,0x24,0x01,0x39,0xE6,0x9C,0x3F,0x01,0x85,0x57,0x0D,0x58,0x87,0x45,0xF8,
    0xD3,0x85,0xAA,0x93,0x69,0x26,0x85,0x70,0x48,0x80,0x3F,0x12,0x15,0xC7,0x79,0xB4,
    0x1F,0x05,0x2F,0x3B,0x62,0x99,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,
    0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x6D,0xEB,
    0x1B,0x09,0xE9,0x5E,0xD9,0x51,0xDB,0x67,0x22,0x61,0xA4,0x2A,0x3C,0x48,0x77,0xE3,
    0xA0,0x7C,0xA6,0xDE,0x73,0xA2,0x14,0x03,0x85,0x3D,0xFB,0xAB,0x0E,0x30,0xC5,0x83,
    0x16,0x33,0x81,0x13,0x08,0x9E,0x7B,0x34,0x4E,0xDF,0x40,0xC8,0x74,0xD7,0xB9,0x7D,
    0xDC,0xF4,0x76,0x55,0x7D,0x9B,0x63,0x54,0x18,0xE9,0xF0,0xEA,0xF3,0x5C,0xB1,0xD9,
    0x8B,0x42,0x1E,0xB9,0xC0,0x95,0x4E,0xBA,0xFA,0xD5,0xE2,0x7C,0xF5,0x68,0x61,0xBF,
    0x8E,0xEC,0x05,0x97,0x5F,0x5B,0xB0,0xD7,0xA3,0x85,0x34,0xC4,0x24,0xA7,0x0D,0x0F,
    0x95,0x93,0xEF,0xCB,0x94,0xD8,0x9E,0x1F,0x9D,0x5C,0x85,0x6D,0xC7,0xAA,0xAE,0x4F,
    0x1F,0x22,0xB5,0xCD,0x95,0xAD,0xBA,0xA7,0xCC,0xF9,0xAB,0x0B,0x7A,0x7F,
};

static const UInt8 RSA_SHA1[]={
    0x30,0x82,0x04,0xBB,0x30,0x82,0x03,0xA3,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x02,
    0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,
    0x62,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,
    0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x13,0x0A,0x41,0x70,0x70,0x6C,0x65,0x20,0x49,
    0x6E,0x63,0x2E,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x41,0x70,
    0x70,0x6C,0x65,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,
    0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x31,0x16,0x30,0x14,0x06,
    0x03,0x55,0x04,0x03,0x13,0x0D,0x41,0x70,0x70,0x6C,0x65,0x20,0x52,0x6F,0x6F,0x74,
    0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x36,0x30,0x34,0x32,0x35,0x32,0x31,0x34,
    0x30,0x33,0x36,0x5A,0x17,0x0D,0x33,0x35,0x30,0x32,0x30,0x39,0x32,0x31,0x34,0x30,
    0x33,0x36,0x5A,0x30,0x62,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,
    0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x13,0x0A,0x41,0x70,0x70,
    0x6C,0x65,0x20,0x49,0x6E,0x63,0x2E,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,
    0x13,0x1D,0x41,0x70,0x70,0x6C,0x65,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,
    0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x31,
    0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x03,0x13,0x0D,0x41,0x70,0x70,0x6C,0x65,0x20,
    0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,
    0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,
    0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xE4,0x91,0xA9,0x09,0x1F,0x91,0xDB,0x1E,
    0x47,0x50,0xEB,0x05,0xED,0x5E,0x79,0x84,0x2D,0xEB,0x36,0xA2,0x57,0x4C,0x55,0xEC,
    0x8B,0x19,0x89,0xDE,0xF9,0x4B,0x6C,0xF5,0x07,0xAB,0x22,0x30,0x02,0xE8,0x18,0x3E,
    0xF8,0x50,0x09,0xD3,0x7F,0x41,0xA8,0x98,0xF9,0xD1,0xCA,0x66,0x9C,0x24,0x6B,0x11,
    0xD0,0xA3,0xBB,0xE4,0x1B,0x2A,0xC3,0x1F,0x95,0x9E,0x7A,0x0C,0xA4,0x47,0x8B,0x5B,
    0xD4,0x16,0x37,0x33,0xCB,0xC4,0x0F,0x4D,0xCE,0x14,0x69,0xD1,0xC9,0x19,0x72,0xF5,
    0x5D,0x0E,0xD5,0x7F,0x5F,0x9B,0xF2,0x25,0x03,0xBA,0x55,0x8F,0x4D,0x5D,0x0D,0xF1,
    0x64,0x35,0x23,0x15,0x4B,0x15,0x59,0x1D,0xB3,0x94,0xF7,0xF6,0x9C,0x9E,0xCF,0x50,
    0xBA,0xC1,0x58,0x50,0x67,0x8F,0x08,0xB4,0x20,0xF7,0xCB,0xAC,0x2C,0x20,0x6F,0x70,
    0xB6,0x3F,0x01,0x30,0x8C,0xB7,0x43,0xCF,0x0F,0x9D,0x3D,0xF3,0x2B,0x49,0x28,0x1A,
    0xC8,0xFE,0xCE,0xB5,0xB9,0x0E,0xD9,0x5E,0x1C,0xD6,0xCB,0x3D,0xB5,0x3A,0xAD,0xF4,
    0x0F,0x0E,0x00,0x92,0x0B,0xB1,0x21,0x16,0x2E,0x74,0xD5,0x3C,0x0D,0xDB,0x62,0x16,
    0xAB,0xA3,0x71,0x92,0x47,0x53,0x55,0xC1,0xAF,0x2F,0x41,0xB3,0xF8,0xFB,0xE3,0x70,
    0xCD,0xE6,0xA3,0x4C,0x45,0x7E,0x1F,0x4C,0x6B,0x50,0x96,0x41,0x89,0xC4,0x74,0x62,
    0x0B,0x10,0x83,0x41,0x87,0x33,0x8A,0x81,0xB1,0x30,0x58,0xEC,0x5A,0x04,0x32,0x8C,
    0x68,0xB3,0x8F,0x1D,0xDE,0x65,0x73,0xFF,0x67,0x5E,0x65,0xBC,0x49,0xD8,0x76,0x9F,
    0x33,0x14,0x65,0xA1,0x77,0x94,0xC9,0x2D,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x01,
    0x7A,0x30,0x82,0x01,0x76,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,
    0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,
    0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,
    0x14,0x2B,0xD0,0x69,0x47,0x94,0x76,0x09,0xFE,0xF4,0x6B,0x8D,0x2E,0x40,0xA6,0xF7,
    0x47,0x4D,0x7F,0x08,0x5E,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,
    0x80,0x14,0x2B,0xD0,0x69,0x47,0x94,0x76,0x09,0xFE,0xF4,0x6B,0x8D,0x2E,0x40,0xA6,
    0xF7,0x47,0x4D,0x7F,0x08,0x5E,0x30,0x82,0x01,0x11,0x06,0x03,0x55,0x1D,0x20,0x04,
    0x82,0x01,0x08,0x30,0x82,0x01,0x04,0x30,0x82,0x01,0x00,0x06,0x09,0x2A,0x86,0x48,
    0x86,0xF7,0x63,0x64,0x05,0x01,0x30,0x81,0xF2,0x30,0x2A,0x06,0x08,0x2B,0x06,0x01,
    0x05,0x05,0x07,0x02,0x01,0x16,0x1E,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,
    0x77,0x77,0x2E,0x61,0x70,0x70,0x6C,0x65,0x2E,0x63,0x6F,0x6D,0x2F,0x61,0x70,0x70,
    0x6C,0x65,0x63,0x61,0x2F,0x30,0x81,0xC3,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,
    0x02,0x02,0x30,0x81,0xB6,0x1A,0x81,0xB3,0x52,0x65,0x6C,0x69,0x61,0x6E,0x63,0x65,
    0x20,0x6F,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,
    0x63,0x61,0x74,0x65,0x20,0x62,0x79,0x20,0x61,0x6E,0x79,0x20,0x70,0x61,0x72,0x74,
    0x79,0x20,0x61,0x73,0x73,0x75,0x6D,0x65,0x73,0x20,0x61,0x63,0x63,0x65,0x70,0x74,
    0x61,0x6E,0x63,0x65,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x74,0x68,0x65,0x6E,
    0x20,0x61,0x70,0x70,0x6C,0x69,0x63,0x61,0x62,0x6C,0x65,0x20,0x73,0x74,0x61,0x6E,
    0x64,0x61,0x72,0x64,0x20,0x74,0x65,0x72,0x6D,0x73,0x20,0x61,0x6E,0x64,0x20,0x63,
    0x6F,0x6E,0x64,0x69,0x74,0x69,0x6F,0x6E,0x73,0x20,0x6F,0x66,0x20,0x75,0x73,0x65,
    0x2C,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x70,0x6F,
    0x6C,0x69,0x63,0x79,0x20,0x61,0x6E,0x64,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,
    0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x70,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,
    0x73,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x73,0x2E,0x30,0x0D,0x06,0x09,0x2A,
    0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x5C,
    0x36,0x99,0x4C,0x2D,0x78,0xB7,0xED,0x8C,0x9B,0xDC,0xF3,0x77,0x9B,0xF2,0x76,0xD2,
    0x77,0x30,0x4F,0xC1,0x1F,0x85,0x83,0x85,0x1B,0x99,0x3D,0x47,0x37,0xF2,0xA9,0x9B,
    0x40,0x8E,0x2C,0xD4,0xB1,0x90,0x12,0xD8,0xBE,0xF4,0x73,0x9B,0xEE,0xD2,0x64,0x0F,
    0xCB,0x79,0x4F,0x34,0xD8,0xA2,0x3E,0xF9,0x78,0xFF,0x6B,0xC8,0x07,0xEC,0x7D,0x39,
    0x83,0x8B,0x53,0x20,0xD3,0x38,0xC4,0xB1,0xBF,0x9A,0x4F,0x0A,0x6B,0xFF,0x2B,0xFC,
    0x59,0xA7,0x05,0x09,0x7C,0x17,0x40,0x56,0x11,0x1E,0x74,0xD3,0xB7,0x8B,0x23,0x3B,
    0x47,0xA3,0xD5,0x6F,0x24,0xE2,0xEB,0xD1,0xB7,0x70,0xDF,0x0F,0x45,0xE1,0x27,0xCA,
    0xF1,0x6D,0x78,0xED,0xE7,0xB5,0x17,0x17,0xA8,0xDC,0x7E,0x22,0x35,0xCA,0x25,0xD5,
    0xD9,0x0F,0xD6,0x6B,0xD4,0xA2,0x24,0x23,0x11,0xF7,0xA1,0xAC,0x8F,0x73,0x81,0x60,
    0xC6,0x1B,0x5B,0x09,0x2F,0x92,0xB2,0xF8,0x44,0x48,0xF0,0x60,0x38,0x9E,0x15,0xF5,
    0x3D,0x26,0x67,0x20,0x8A,0x33,0x6A,0xF7,0x0D,0x82,0xCF,0xDE,0xEB,0xA3,0x2F,0xF9,
    0x53,0x6A,0x5B,0x64,0xC0,0x63,0x33,0x77,0xF7,0x3A,0x07,0x2C,0x56,0xEB,0xDA,0x0F,
    0x21,0x0E,0xDA,0xBA,0x73,0x19,0x4F,0xB5,0xD9,0x36,0x7F,0xC1,0x87,0x55,0xD9,0xA7,
    0x99,0xB9,0x32,0x42,0xFB,0xD8,0xD5,0x71,0x9E,0x7E,0xA1,0x52,0xB7,0x1B,0xBD,0x93,
    0x42,0x24,0x12,0x2A,0xC7,0x0F,0x1D,0xB6,0x4D,0x9C,0x5E,0x63,0xC8,0x4B,0x80,0x17,
    0x50,0xAA,0x8A,0xD5,0xDA,0xE4,0xFC,0xD0,0x09,0x07,0x37,0xB0,0x75,0x75,0x21,
};

static const UInt8 RSA_SHA256[]={
    0x30,0x82,0x03,0x5F,0x30,0x82,0x02,0x47,0xA0,0x03,0x02,0x01,0x02,0x02,0x0B,0x04,
    0x00,0x00,0x00,0x00,0x01,0x21,0x58,0x53,0x08,0xA2,0x30,0x0D,0x06,0x09,0x2A,0x86,
    0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x4C,0x31,0x20,0x30,0x1E,0x06,
    0x03,0x55,0x04,0x0B,0x13,0x17,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,
    0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x52,0x33,0x31,0x13,0x30,
    0x11,0x06,0x03,0x55,0x04,0x0A,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,
    0x67,0x6E,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,
    0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x30,0x1E,0x17,0x0D,0x30,0x39,0x30,0x33,0x31,
    0x38,0x31,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x32,0x39,0x30,0x33,0x31,0x38,
    0x31,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x4C,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,
    0x04,0x0B,0x13,0x17,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x20,0x52,
    0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x52,0x33,0x31,0x13,0x30,0x11,0x06,
    0x03,0x55,0x04,0x0A,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,
    0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,
    0x6C,0x53,0x69,0x67,0x6E,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,
    0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,
    0x0A,0x02,0x82,0x01,0x01,0x00,0xCC,0x25,0x76,0x90,0x79,0x06,0x78,0x22,0x16,0xF5,
    0xC0,0x83,0xB6,0x84,0xCA,0x28,0x9E,0xFD,0x05,0x76,0x11,0xC5,0xAD,0x88,0x72,0xFC,
    0x46,0x02,0x43,0xC7,0xB2,0x8A,0x9D,0x04,0x5F,0x24,0xCB,0x2E,0x4B,0xE1,0x60,0x82,
    0x46,0xE1,0x52,0xAB,0x0C,0x81,0x47,0x70,0x6C,0xDD,0x64,0xD1,0xEB,0xF5,0x2C,0xA3,
    0x0F,0x82,0x3D,0x0C,0x2B,0xAE,0x97,0xD7,0xB6,0x14,0x86,0x10,0x79,0xBB,0x3B,0x13,
    0x80,0x77,0x8C,0x08,0xE1,0x49,0xD2,0x6A,0x62,0x2F,0x1F,0x5E,0xFA,0x96,0x68,0xDF,
    0x89,0x27,0x95,0x38,0x9F,0x06,0xD7,0x3E,0xC9,0xCB,0x26,0x59,0x0D,0x73,0xDE,0xB0,
    0xC8,0xE9,0x26,0x0E,0x83,0x15,0xC6,0xEF,0x5B,0x8B,0xD2,0x04,0x60,0xCA,0x49,0xA6,
    0x28,0xF6,0x69,0x3B,0xF6,0xCB,0xC8,0x28,0x91,0xE5,0x9D,0x8A,0x61,0x57,0x37,0xAC,
    0x74,0x14,0xDC,0x74,0xE0,0x3A,0xEE,0x72,0x2F,0x2E,0x9C,0xFB,0xD0,0xBB,0xBF,0xF5,
    0x3D,0x00,0xE1,0x06,0x33,0xE8,0x82,0x2B,0xAE,0x53,0xA6,0x3A,0x16,0x73,0x8C,0xDD,
    0x41,0x0E,0x20,0x3A,0xC0,0xB4,0xA7,0xA1,0xE9,0xB2,0x4F,0x90,0x2E,0x32,0x60,0xE9,
    0x57,0xCB,0xB9,0x04,0x92,0x68,0x68,0xE5,0x38,0x26,0x60,0x75,0xB2,0x9F,0x77,0xFF,
    0x91,0x14,0xEF,0xAE,0x20,0x49,0xFC,0xAD,0x40,0x15,0x48,0xD1,0x02,0x31,0x61,0x19,
    0x5E,0xB8,0x97,0xEF,0xAD,0x77,0xB7,0x64,0x9A,0x7A,0xBF,0x5F,0xC1,0x13,0xEF,0x9B,
    0x62,0xFB,0x0D,0x6C,0xE0,0x54,0x69,0x16,0xA9,0x03,0xDA,0x6E,0xE9,0x83,0x93,0x71,
    0x76,0xC6,0x69,0x85,0x82,0x17,0x02,0x03,0x01,0x00,0x01,0xA3,0x42,0x30,0x40,0x30,
    0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,
    0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,
    0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x8F,0xF0,0x4B,0x7F,0xA8,
    0x2E,0x45,0x24,0xAE,0x4D,0x50,0xFA,0x63,0x9A,0x8B,0xDE,0xE2,0xDD,0x1B,0xBC,0x30,
    0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,
    0x01,0x01,0x00,0x4B,0x40,0xDB,0xC0,0x50,0xAA,0xFE,0xC8,0x0C,0xEF,0xF7,0x96,0x54,
    0x45,0x49,0xBB,0x96,0x00,0x09,0x41,0xAC,0xB3,0x13,0x86,0x86,0x28,0x07,0x33,0xCA,
    0x6B,0xE6,0x74,0xB9,0xBA,0x00,0x2D,0xAE,0xA4,0x0A,0xD3,0xF5,0xF1,0xF1,0x0F,0x8A,
    0xBF,0x73,0x67,0x4A,0x83,0xC7,0x44,0x7B,0x78,0xE0,0xAF,0x6E,0x6C,0x6F,0x03,0x29,
    0x8E,0x33,0x39,0x45,0xC3,0x8E,0xE4,0xB9,0x57,0x6C,0xAA,0xFC,0x12,0x96,0xEC,0x53,
    0xC6,0x2D,0xE4,0x24,0x6C,0xB9,0x94,0x63,0xFB,0xDC,0x53,0x68,0x67,0x56,0x3E,0x83,
    0xB8,0xCF,0x35,0x21,0xC3,0xC9,0x68,0xFE,0xCE,0xDA,0xC2,0x53,0xAA,0xCC,0x90,0x8A,
    0xE9,0xF0,0x5D,0x46,0x8C,0x95,0xDD,0x7A,0x58,0x28,0x1A,0x2F,0x1D,0xDE,0xCD,0x00,
    0x37,0x41,0x8F,0xED,0x44,0x6D,0xD7,0x53,0x28,0x97,0x7E,0xF3,0x67,0x04,0x1E,0x15,
    0xD7,0x8A,0x96,0xB4,0xD3,0xDE,0x4C,0x27,0xA4,0x4C,0x1B,0x73,0x73,0x76,0xF4,0x17,
    0x99,0xC2,0x1F,0x7A,0x0E,0xE3,0x2D,0x08,0xAD,0x0A,0x1C,0x2C,0xFF,0x3C,0xAB,0x55,
    0x0E,0x0F,0x91,0x7E,0x36,0xEB,0xC3,0x57,0x49,0xBE,0xE1,0x2E,0x2D,0x7C,0x60,0x8B,
    0xC3,0x41,0x51,0x13,0x23,0x9D,0xCE,0xF7,0x32,0x6B,0x94,0x01,0xA8,0x99,0xE7,0x2C,
    0x33,0x1F,0x3A,0x3B,0x25,0xD2,0x86,0x40,0xCE,0x3B,0x2C,0x86,0x78,0xC9,0x61,0x2F,
    0x14,0xBA,0xEE,0xDB,0x55,0x6F,0xDF,0x84,0xEE,0x05,0x09,0x4D,0xBD,0x28,0xD8,0x72,
    0xCE,0xD3,0x62,0x50,0x65,0x1E,0xEB,0x92,0x97,0x83,0x31,0xD9,0xB3,0xB5,0xCA,0x47,
    0x58,0x3F,0x5F,
};

static const UInt8 RSA_SHA512[]={
    0x30,0x82,0x05,0xD3,0x30,0x82,0x03,0xBB,0xA0,0x03,0x02,0x01,0x02,0x02,0x15,0x00,
    0xB8,0x59,0x14,0x71,0x3F,0x57,0xDF,0x8F,0x31,0xC0,0x33,0x3D,0xD2,0xD6,0x19,0x7A,
    0x23,0x17,0xB4,0xEB,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,
    0x0D,0x05,0x00,0x30,0x81,0x80,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,
    0x02,0x50,0x4C,0x31,0x22,0x30,0x20,0x06,0x03,0x55,0x04,0x0A,0x13,0x19,0x55,0x6E,
    0x69,0x7A,0x65,0x74,0x6F,0x20,0x54,0x65,0x63,0x68,0x6E,0x6F,0x6C,0x6F,0x67,0x69,
    0x65,0x73,0x20,0x53,0x2E,0x41,0x2E,0x31,0x27,0x30,0x25,0x06,0x03,0x55,0x04,0x0B,
    0x13,0x1E,0x43,0x65,0x72,0x74,0x75,0x6D,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,
    0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,
    0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x43,0x65,0x72,0x74,0x75,
    0x6D,0x20,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,
    0x6B,0x20,0x43,0x41,0x20,0x32,0x30,0x1E,0x17,0x0D,0x31,0x31,0x31,0x30,0x30,0x36,
    0x30,0x38,0x33,0x39,0x35,0x36,0x5A,0x17,0x0D,0x34,0x36,0x31,0x30,0x30,0x36,0x30,
    0x38,0x33,0x39,0x35,0x36,0x5A,0x30,0x81,0x80,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,
    0x04,0x06,0x13,0x02,0x50,0x4C,0x31,0x22,0x30,0x20,0x06,0x03,0x55,0x04,0x0A,0x13,
    0x19,0x55,0x6E,0x69,0x7A,0x65,0x74,0x6F,0x20,0x54,0x65,0x63,0x68,0x6E,0x6F,0x6C,
    0x6F,0x67,0x69,0x65,0x73,0x20,0x53,0x2E,0x41,0x2E,0x31,0x27,0x30,0x25,0x06,0x03,
    0x55,0x04,0x0B,0x13,0x1E,0x43,0x65,0x72,0x74,0x75,0x6D,0x20,0x43,0x65,0x72,0x74,
    0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,
    0x69,0x74,0x79,0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x43,0x65,
    0x72,0x74,0x75,0x6D,0x20,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x4E,0x65,0x74,
    0x77,0x6F,0x72,0x6B,0x20,0x43,0x41,0x20,0x32,0x30,0x82,0x02,0x22,0x30,0x0D,0x06,
    0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x02,0x0F,
    0x00,0x30,0x82,0x02,0x0A,0x02,0x82,0x02,0x01,0x00,0xBD,0xF9,0x78,0xF8,0xE6,0xD5,
    0x80,0x0C,0x64,0x9D,0x86,0x1B,0x96,0x64,0x67,0x3F,0x22,0x3A,0x1E,0x75,0x01,0x7D,
    0xEF,0xFB,0x5C,0x67,0x8C,0xC9,0xCC,0x5C,0x6B,0xA9,0x91,0xE6,0xB9,0x42,0xE5,0x20,
    0x4B,0x9B,0xDA,0x9B,0x7B,0xB9,0x99,0x5D,0xD9,0x9B,0x80,0x4B,0xD7,0x84,0x40,0x2B,
    0x27,0xD3,0xE8,0xBA,0x30,0xBB,0x3E,0x09,0x1A,0xA7,0x49,0x95,0xEF,0x2B,0x40,0x24,
    0xC2,0x97,0xC7,0xA7,0xEE,0x9B,0x25,0xEF,0xA8,0x0A,0x00,0x97,0x85,0x5A,0xAA,0x9D,
    0xDC,0x29,0xC9,0xE2,0x35,0x07,0xEB,0x70,0x4D,0x4A,0xD6,0xC1,0xB3,0x56,0xB8,0xA1,
    0x41,0x38,0x9B,0xD1,0xFB,0x31,0x7F,0x8F,0xE0,0x5F,0xE1,0xB1,0x3F,0x0F,0x8E,0x16,
    0x49,0x60,0xD7,0x06,0x8D,0x18,0xF9,0xAA,0x26,0x10,0xAB,0x2A,0xD3,0xD0,0xD1,0x67,
    0x8D,0x1B,0x46,0xBE,0x47,0x30,0xD5,0x2E,0x72,0xD1,0xC5,0x63,0xDA,0xE7,0x63,0x79,
    0x44,0x7E,0x4B,0x63,0x24,0x89,0x86,0x2E,0x34,0x3F,0x29,0x4C,0x52,0x8B,0x2A,0xA7,
    0xC0,0xE2,0x91,0x28,0x89,0xB9,0xC0,0x5B,0xF9,0x1D,0xD9,0xE7,0x27,0xAD,0xFF,0x9A,
    0x02,0x97,0xC1,0xC6,0x50,0x92,0x9B,0x02,0x2C,0xBD,0xA9,0xB9,0x34,0x59,0x0A,0xBF,
    0x84,0x4A,0xFF,0xDF,0xFE,0xB3,0x9F,0xEB,0xD9,0x9E,0xE0,0x98,0x23,0xEC,0xA6,0x6B,
    0x77,0x16,0x2A,0xDB,0xCC,0xAD,0x3B,0x1C,0xA4,0x87,0xDC,0x46,0x73,0x5E,0x19,0x62,
    0x68,0x45,0x57,0xE4,0x90,0x82,0x42,0xBB,0x42,0xD6,0xF0,0x61,0xE0,0xC1,0xA3,0x3D,
    0x66,0xA3,0x5D,0xF4,0x18,0xEE,0x88,0xC9,0x8D,0x17,0x45,0x29,0x99,0x32,0x75,0x02,
    0x31,0xEE,0x29,0x26,0xC8,0x6B,0x02,0xE6,0xB5,0x62,0x45,0x7F,0x37,0x15,0x5A,0x23,
    0x68,0x89,0xD4,0x3E,0xDE,0x4E,0x27,0xB0,0xF0,0x40,0x0C,0xBC,0x4D,0x17,0xCB,0x4D,
    0xA2,0xB3,0x1E,0xD0,0x06,0x5A,0xDD,0xF6,0x93,0xCF,0x57,0x75,0x99,0xF5,0xFA,0x86,
    0x1A,0x67,0x78,0xB3,0xBF,0x96,0xFE,0x34,0xDC,0xBD,0xE7,0x52,0x56,0xE5,0xB3,0xE5,
    0x75,0x7B,0xD7,0x41,0x91,0x05,0xDC,0x5D,0x69,0xE3,0x95,0x0D,0x43,0xB9,0xFC,0x83,
    0x96,0x39,0x95,0x7B,0x6C,0x80,0x5A,0x4F,0x13,0x72,0xC6,0xD7,0x7D,0x29,0x7A,0x44,
    0xBA,0x52,0xA4,0x2A,0xD5,0x41,0x46,0x09,0x20,0xFE,0x22,0xA0,0xB6,0x5B,0x30,0x8D,
    0xBC,0x89,0x0C,0xD5,0xD7,0x70,0xF8,0x87,0x52,0xFD,0xDA,0xEF,0xAC,0x51,0x2E,0x07,
    0xB3,0x4E,0xFE,0xD0,0x09,0xDA,0x70,0xEF,0x98,0xFA,0x56,0xE6,0x6D,0xDB,0xB5,0x57,
    0x4B,0xDC,0xE5,0x2C,0x25,0x15,0xC8,0x9E,0x2E,0x78,0x4E,0xF8,0xDA,0x9C,0x9E,0x86,
    0x2C,0xCA,0x57,0xF3,0x1A,0xE5,0xC8,0x92,0x8B,0x1A,0x82,0x96,0x7A,0xC3,0xBC,0x50,
    0x12,0x69,0xD8,0x0E,0x5A,0x46,0x8B,0x3A,0xEB,0x26,0xFA,0x23,0xC9,0xB6,0xB0,0x81,
    0xBE,0x42,0x00,0xA4,0xF8,0xD6,0xFE,0x30,0x2E,0xC7,0xD2,0x46,0xF6,0xE5,0x8E,0x75,
    0xFD,0xF2,0xCC,0xB9,0xD0,0x87,0x5B,0xCC,0x06,0x10,0x60,0xBB,0x83,0x35,0xB7,0x5E,
    0x67,0xDE,0x47,0xEC,0x99,0x48,0xF1,0xA4,0xA1,0x15,0xFE,0xAD,0x8C,0x62,0x8E,0x39,
    0x55,0x4F,0x39,0x16,0xB9,0xB1,0x63,0x9D,0xFF,0xB7,0x02,0x03,0x01,0x00,0x01,0xA3,
    0x42,0x30,0x40,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,
    0x03,0x01,0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xB6,
    0xA1,0x54,0x39,0x02,0xC3,0xA0,0x3F,0x8E,0x8A,0xBC,0xFA,0xD4,0xF8,0x1C,0xA6,0xD1,
    0x3A,0x0E,0xFD,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,
    0x02,0x01,0x06,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0D,
    0x05,0x00,0x03,0x82,0x02,0x01,0x00,0x9D,0x53,0xC2,0x81,0x25,0xDC,0x35,0x2C,0xAE,
    0x0A,0xDD,0x5A,0x9B,0x46,0x30,0x56,0xBB,0xD4,0xB4,0x6C,0x4B,0x86,0xE6,0x0A,0xA5,
    0xD2,0x92,0x8A,0x9A,0x8D,0xDC,0x8F,0xB4,0xEE,0x76,0xF4,0x03,0xCB,0xEB,0x9B,0x01,
    0x78,0xAB,0x2A,0x6B,0xB5,0xBA,0x23,0x4E,0x31,0x7C,0xB5,0x2C,0xDD,0x2D,0x69,0x67,
    0x33,0x6E,0x63,0x5D,0x39,0x18,0x12,0xF8,0xA0,0x28,0x53,0x44,0x87,0xAB,0x6A,0xC4,
    0x92,0x96,0x1F,0x2A,0xA2,0x1C,0xBA,0x9D,0xDD,0x27,0xFB,0x52,0x4D,0xB0,0x8F,0x5A,
    0xE8,0xED,0x8D,0xC3,0x68,0xE3,0x92,0xA0,0x26,0x0C,0x87,0x90,0xB0,0x03,0xEA,0x6A,
    0x65,0x28,0x08,0xC4,0x46,0x78,0xE0,0x5B,0xBA,0x0E,0xF0,0x33,0xDC,0x27,0xB6,0x7E,
    0x88,0x3D,0xBD,0x92,0xA4,0x96,0x7E,0x41,0xA8,0x80,0x08,0x7B,0xD6,0x36,0x12,0xBC,
    0x10,0x15,0x9B,0x24,0xBC,0xAB,0xAD,0x7D,0x11,0x89,0x2F,0x31,0xED,0xF8,0xD2,0xCF,
    0x53,0x8E,0xEB,0xB4,0x53,0xA7,0xE7,0x04,0xCA,0x2F,0xA6,0x22,0xC4,0x11,0xDC,0xEB,
    0x98,0xC9,0x22,0x5D,0x41,0x6A,0xDC,0x0A,0x52,0x04,0x5B,0xBC,0x2E,0xA0,0x7D,0xC7,
    0xB6,0x92,0xBB,0x24,0xA0,0xF3,0x37,0xD1,0x2B,0x43,0xA8,0xCC,0xF1,0x68,0x78,0x1A,
    0x7E,0x6F,0x63,0x90,0x7B,0x9F,0x74,0xC8,0x6B,0xD9,0x0B,0x55,0xF6,0x79,0x03,0x3D,
    0x83,0xC7,0x41,0x40,0x92,0xFB,0x76,0x0B,0x37,0x25,0x17,0x3C,0xAF,0x3E,0xFA,0x3C,
    0x5C,0x1B,0x86,0xF9,0x4A,0x0C,0x3F,0x8A,0xC4,0x5E,0x0E,0x98,0xF1,0xAD,0xEE,0xCF,
    0xE0,0xFD,0x21,0x35,0xC7,0x33,0x61,0xCC,0xA2,0x37,0x18,0x43,0x7C,0x33,0xE9,0xAE,
    0x76,0x82,0x82,0x07,0x45,0x48,0x3B,0xC9,0x67,0x6E,0xAD,0xA3,0x85,0xE8,0x96,0x56,
    0xCF,0xBC,0xBB,0xFA,0xAB,0xCB,0xB7,0x57,0x27,0x8D,0x1A,0x2F,0x99,0xF3,0x23,0x33,
    0x34,0x8E,0xCA,0x53,0x63,0xD3,0x57,0x34,0x50,0x4F,0xCF,0x49,0xC1,0x05,0xBA,0xC5,
    0xA8,0x87,0x7B,0xE3,0x86,0x8F,0xFB,0x43,0xA2,0x12,0xE9,0xAC,0x51,0xEC,0x04,0x76,
    0x4C,0xF0,0xFA,0x8F,0xB9,0x31,0x13,0xE9,0x08,0xB7,0x24,0x09,0xF9,0xA0,0xB7,0x07,
    0x36,0x58,0x57,0xCF,0xC4,0xBB,0x7E,0x49,0x66,0x95,0x35,0x04,0xB6,0x77,0x35,0xB8,
    0xA9,0x53,0x29,0x5F,0x92,0x85,0xF8,0x52,0xC4,0x5A,0x4E,0xFD,0x06,0x61,0x39,0xFB,
    0x7D,0xD0,0x76,0x47,0x92,0xCC,0xEC,0x2B,0xBD,0x84,0x6E,0xE6,0x9B,0x45,0xC1,0x7D,
    0x62,0xB1,0x53,0x2D,0x9E,0x75,0xA0,0xE7,0xC9,0x28,0x50,0xD7,0xE5,0xBC,0xA8,0xAA,
    0x07,0x78,0x6A,0xB9,0x74,0xB4,0x60,0xF3,0x84,0x8D,0x03,0xDC,0xAE,0x91,0xDA,0x74,
    0x44,0x0D,0x7B,0x42,0xA9,0x77,0xD6,0x2B,0x7C,0xA1,0xC6,0x6C,0x13,0x53,0x22,0xA9,
    0x12,0x9A,0xA5,0xF9,0x4F,0x28,0x45,0x35,0xB0,0x97,0x4F,0x46,0x65,0x85,0xC5,0xF4,
    0xFD,0x62,0xA2,0xA2,0x6A,0xFC,0x34,0x30,0x06,0x7E,0xDF,0x0C,0xE0,0x73,0x81,0x96,
    0xC9,0x44,0x2A,0xDE,0x1F,0x82,0xEC,0x6C,0x72,0x57,0xAD,0x29,0x64,0xA4,0xF1,0xC6,
    0x29,0x8E,0x35,0x60,0x53,0xCE,0x6B,0xD9,0x02,0xBE,0x39,0x30,0x75,0xE0,0xF7,0x5C,
    0x63,0x6A,0xF0,0x40,0xC1,0x2C,0x8D,
};

static const UInt8 ECDSA_SHA1[]={
    0x30,0x82,0x02,0x40,0x30,0x82,0x01,0xE7,0xA0,0x03,0x02,0x01,0x02,0x02,0x02,0x04,
    0x19,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x01,0x30,0x81,0x9B,0x31,
    0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0B,0x13,0x0B,0x53,0x41,0x4D,0x50,0x4C,0x45,
    0x20,0x4F,0x4E,0x4C,0x59,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,
    0x43,0x65,0x72,0x74,0x69,0x63,0x6F,0x6D,0x20,0x43,0x6F,0x72,0x70,0x2E,0x31,0x10,
    0x30,0x0E,0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x54,0x6F,0x72,0x6F,0x6E,0x74,0x6F,
    0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x04,0x13,0x07,0x4F,0x6E,0x74,0x61,0x72,
    0x69,0x6F,0x31,0x39,0x30,0x37,0x06,0x03,0x55,0x04,0x03,0x13,0x30,0x74,0x6C,0x73,
    0x2E,0x73,0x65,0x63,0x67,0x2E,0x6F,0x72,0x67,0x20,0x45,0x43,0x43,0x20,0x73,0x65,
    0x63,0x70,0x32,0x35,0x36,0x72,0x31,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,
    0x61,0x74,0x65,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x31,0x0B,0x30,
    0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x36,
    0x30,0x35,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x31,0x35,0x30,
    0x35,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x81,0x8B,0x31,0x14,0x30,
    0x12,0x06,0x03,0x55,0x04,0x0B,0x13,0x0B,0x53,0x41,0x4D,0x50,0x4C,0x45,0x20,0x4F,
    0x4E,0x4C,0x59,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x43,0x65,
    0x72,0x74,0x69,0x63,0x6F,0x6D,0x20,0x43,0x6F,0x72,0x70,0x2E,0x31,0x10,0x30,0x0E,
    0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x54,0x6F,0x72,0x6F,0x6E,0x74,0x6F,0x31,0x10,
    0x30,0x0E,0x06,0x03,0x55,0x04,0x04,0x13,0x07,0x4F,0x6E,0x74,0x61,0x72,0x69,0x6F,
    0x31,0x36,0x30,0x34,0x06,0x03,0x55,0x04,0x03,0x13,0x2D,0x74,0x6C,0x73,0x2E,0x73,
    0x65,0x63,0x67,0x2E,0x6F,0x72,0x67,0x20,0x45,0x43,0x43,0x20,0x73,0x65,0x63,0x70,
    0x32,0x35,0x36,0x72,0x31,0x20,0x43,0x6C,0x69,0x65,0x6E,0x74,0x20,0x43,0x65,0x72,
    0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x30,0x59,0x30,0x13,0x06,0x07,0x2A,0x86,
    0x48,0xCE,0x3D,0x02,0x01,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x07,0x03,
    0x42,0x00,0x04,0x36,0x48,0x98,0xF8,0xB3,0xD0,0xC4,0x2E,0xCA,0x99,0x3D,0x14,0xBB,
    0x14,0x24,0xF5,0x89,0x82,0x36,0xE3,0x34,0xB2,0xF5,0x35,0x07,0xD0,0xA8,0xDE,0x14,
    0x84,0xD7,0x78,0xA4,0x62,0x01,0x77,0xEA,0xBD,0xA9,0xA3,0x9F,0x8B,0x48,0x5F,0x3C,
    0x7A,0xA1,0x96,0x40,0xD1,0x2C,0xB6,0xDD,0xEA,0x21,0xF8,0xED,0x29,0x70,0x44,0x80,
    0x49,0x2E,0x77,0xA3,0x2A,0x30,0x28,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,
    0xFF,0x04,0x04,0x03,0x02,0x03,0x88,0x30,0x16,0x06,0x03,0x55,0x1D,0x25,0x01,0x01,
    0xFF,0x04,0x0C,0x30,0x0A,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x02,0x30,
    0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x01,0x03,0x48,0x00,0x30,0x45,0x02,
    0x20,0x45,0xA2,0x99,0x2C,0xE0,0x08,0xB2,0xEE,0x09,0xCD,0x1D,0x51,0x42,0x60,0x3F,
    0x56,0x4D,0x2D,0xA1,0x7D,0xAB,0xD0,0xF5,0x6D,0xF7,0xF0,0xE2,0x23,0x33,0xBC,0xBD,
    0xB3,0x02,0x21,0x00,0xCD,0xFB,0x57,0x1C,0x3A,0x32,0xD1,0xBC,0x67,0xBB,0x0F,0x1D,
    0x12,0xEB,0x63,0x12,0x1F,0x50,0x37,0x67,0x77,0x66,0x2B,0xE1,0x37,0xD4,0x8F,0xDD,
    0xE0,0xAA,0xE4,0x22,
};

static const UInt8 ECDSA_SHA256[] = {
    0x30,0x82,0x01,0xE1,0x30,0x82,0x01,0x87,0xA0,0x03,0x02,0x01,0x02,0x02,0x11,0x2A,
    0x38,0xA4,0x1C,0x96,0x0A,0x04,0xDE,0x42,0xB2,0x28,0xA5,0x0B,0xE8,0x34,0x98,0x02,
    0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x02,0x30,0x50,0x31,0x24,
    0x30,0x22,0x06,0x03,0x55,0x04,0x0B,0x13,0x1B,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,
    0x69,0x67,0x6E,0x20,0x45,0x43,0x43,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,
    0x2D,0x20,0x52,0x34,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x13,0x0A,0x47,
    0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x31,0x13,0x30,0x11,0x06,0x03,0x55,
    0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x30,0x1E,
    0x17,0x0D,0x31,0x32,0x31,0x31,0x31,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,
    0x0D,0x33,0x38,0x30,0x31,0x31,0x39,0x30,0x33,0x31,0x34,0x30,0x37,0x5A,0x30,0x50,
    0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x0B,0x13,0x1B,0x47,0x6C,0x6F,0x62,0x61,
    0x6C,0x53,0x69,0x67,0x6E,0x20,0x45,0x43,0x43,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,
    0x41,0x20,0x2D,0x20,0x52,0x34,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x13,
    0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,0x31,0x13,0x30,0x11,0x06,
    0x03,0x55,0x04,0x03,0x13,0x0A,0x47,0x6C,0x6F,0x62,0x61,0x6C,0x53,0x69,0x67,0x6E,
    0x30,0x59,0x30,0x13,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x08,0x2A,
    0x86,0x48,0xCE,0x3D,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0xB8,0xC6,0x79,0xD3,0x8F,
    0x6C,0x25,0x0E,0x9F,0x2E,0x39,0x19,0x1C,0x03,0xA4,0xAE,0x9A,0xE5,0x39,0x07,0x09,
    0x16,0xCA,0x63,0xB1,0xB9,0x86,0xF8,0x8A,0x57,0xC1,0x57,0xCE,0x42,0xFA,0x73,0xA1,
    0xF7,0x65,0x42,0xFF,0x1E,0xC1,0x00,0xB2,0x6E,0x73,0x0E,0xFF,0xC7,0x21,0xE5,0x18,
    0xA4,0xAA,0xD9,0x71,0x3F,0xA8,0xD4,0xB9,0xCE,0x8C,0x1D,0xA3,0x42,0x30,0x40,0x30,
    0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,
    0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,
    0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x54,0xB0,0x7B,0xAD,0x45,
    0xB8,0xE2,0x40,0x7F,0xFB,0x0A,0x6E,0xFB,0xBE,0x33,0xC9,0x3C,0xA3,0x84,0xD5,0x30,
    0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x02,0x03,0x48,0x00,0x30,0x45,
    0x02,0x21,0x00,0xDC,0x92,0xA1,0xA0,0x13,0xA6,0xCF,0x03,0xB0,0xE6,0xC4,0x21,0x97,
    0x90,0xFA,0x14,0x57,0x2D,0x03,0xEC,0xEE,0x3C,0xD3,0x6E,0xCA,0xA8,0x6C,0x76,0xBC,
    0xA2,0xDE,0xBB,0x02,0x20,0x27,0xA8,0x85,0x27,0x35,0x9B,0x56,0xC6,0xA3,0xF2,0x47,
    0xD2,0xB7,0x6E,0x1B,0x02,0x00,0x17,0xAA,0x67,0xA6,0x15,0x91,0xDE,0xFA,0x94,0xEC,
    0x7B,0x0B,0xF8,0x9F,0x84,
};

static const UInt8 ECDSA_SHA384[] = {
    0x30,0x82,0x02,0x43,0x30,0x82,0x01,0xC9,0xA0,0x03,0x02,0x01,0x02,0x02,0x08,0x2D,
    0xC5,0xFC,0x88,0xD2,0xC5,0x4B,0x95,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,
    0x04,0x03,0x03,0x30,0x67,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x03,0x0C,0x12,
    0x41,0x70,0x70,0x6C,0x65,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,
    0x47,0x33,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x0C,0x1D,0x41,0x70,0x70,
    0x6C,0x65,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,
    0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x31,0x13,0x30,0x11,0x06,0x03,
    0x55,0x04,0x0A,0x0C,0x0A,0x41,0x70,0x70,0x6C,0x65,0x20,0x49,0x6E,0x63,0x2E,0x31,
    0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x30,0x1E,0x17,0x0D,
    0x31,0x34,0x30,0x34,0x33,0x30,0x31,0x38,0x31,0x39,0x30,0x36,0x5A,0x17,0x0D,0x33,
    0x39,0x30,0x34,0x33,0x30,0x31,0x38,0x31,0x39,0x30,0x36,0x5A,0x30,0x67,0x31,0x1B,
    0x30,0x19,0x06,0x03,0x55,0x04,0x03,0x0C,0x12,0x41,0x70,0x70,0x6C,0x65,0x20,0x52,
    0x6F,0x6F,0x74,0x20,0x43,0x41,0x20,0x2D,0x20,0x47,0x33,0x31,0x26,0x30,0x24,0x06,
    0x03,0x55,0x04,0x0B,0x0C,0x1D,0x41,0x70,0x70,0x6C,0x65,0x20,0x43,0x65,0x72,0x74,
    0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,
    0x69,0x74,0x79,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0A,0x0C,0x0A,0x41,0x70,
    0x70,0x6C,0x65,0x20,0x49,0x6E,0x63,0x2E,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,
    0x06,0x13,0x02,0x55,0x53,0x30,0x76,0x30,0x10,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,
    0x02,0x01,0x06,0x05,0x2B,0x81,0x04,0x00,0x22,0x03,0x62,0x00,0x04,0x98,0xE9,0x2F,
    0x3D,0x40,0x72,0xA4,0xED,0x93,0x22,0x72,0x81,0x13,0x1C,0xDD,0x10,0x95,0xF1,0xC5,
    0xA3,0x4E,0x71,0xDC,0x14,0x16,0xD9,0x0E,0xE5,0xA6,0x05,0x2A,0x77,0x64,0x7B,0x5F,
    0x4E,0x38,0xD3,0xBB,0x1C,0x44,0xB5,0x7F,0xF5,0x1F,0xB6,0x32,0x62,0x5D,0xC9,0xE9,
    0x84,0x5B,0x4F,0x30,0x4F,0x11,0x5A,0x00,0xFD,0x58,0x58,0x0C,0xA5,0xF5,0x0F,0x2C,
    0x4D,0x07,0x47,0x13,0x75,0xDA,0x97,0x97,0x97,0x6F,0x31,0x5C,0xED,0x2B,0x9D,0x7B,
    0x20,0x3B,0xD8,0xB9,0x54,0xD9,0x5E,0x99,0xA4,0x3A,0x51,0x0A,0x31,0xA3,0x42,0x30,
    0x40,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xBB,0xB0,0xDE,0xA1,
    0x58,0x33,0x88,0x9A,0xA4,0x8A,0x99,0xDE,0xBE,0xBD,0xEB,0xAF,0xDA,0xCB,0x24,0xAB,
    0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,
    0xFF,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,
    0x06,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x03,0x68,0x00,
    0x30,0x65,0x02,0x31,0x00,0x83,0xE9,0xC1,0xC4,0x16,0x5E,0x1A,0x5D,0x34,0x18,0xD9,
    0xED,0xEF,0xF4,0x6C,0x0E,0x00,0x46,0x4B,0xB8,0xDF,0xB2,0x46,0x11,0xC5,0x0F,0xFD,
    0xE6,0x7A,0x8C,0xA1,0xA6,0x6B,0xCE,0xC2,0x03,0xD4,0x9C,0xF5,0x93,0xC6,0x74,0xB8,
    0x6A,0xDF,0xAA,0x23,0x15,0x02,0x30,0x6D,0x66,0x8A,0x10,0xCA,0xD4,0x0D,0xD4,0x4F,
    0xCD,0x8D,0x43,0x3E,0xB4,0x8A,0x63,0xA5,0x33,0x6E,0xE3,0x6D,0xDA,0x17,0xB7,0x64,
    0x1F,0xC8,0x53,0x26,0xF9,0x88,0x62,0x74,0x39,0x0B,0x17,0x5B,0xCB,0x51,0xA8,0x0C,
    0xE8,0x18,0x03,0xE7,0xA2,0xB2,0x28,
};

static const UInt8 DSA_SHA1[] = {
    0x30,0x82,0x02,0x1E,0x30,0x82,0x01,0xDD,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x02,
    0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x30,0x3F,0x31,0x0B,0x30,
    0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1F,0x30,0x1D,0x06,0x03,
    0x55,0x04,0x0A,0x13,0x16,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,
    0x69,0x63,0x61,0x74,0x65,0x73,0x20,0x32,0x30,0x31,0x31,0x31,0x0F,0x30,0x0D,0x06,
    0x03,0x55,0x04,0x03,0x13,0x06,0x44,0x53,0x41,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,
    0x31,0x30,0x30,0x31,0x30,0x31,0x30,0x38,0x33,0x30,0x30,0x30,0x5A,0x17,0x0D,0x33,
    0x30,0x31,0x32,0x33,0x31,0x30,0x38,0x33,0x30,0x30,0x30,0x5A,0x30,0x54,0x31,0x0B,
    0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1F,0x30,0x1D,0x06,
    0x03,0x55,0x04,0x0A,0x13,0x16,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,
    0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x20,0x32,0x30,0x31,0x31,0x31,0x24,0x30,0x22,
    0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x44,0x53,0x41,0x20,0x50,0x61,0x72,0x61,0x6D,
    0x65,0x74,0x65,0x72,0x73,0x20,0x49,0x6E,0x68,0x65,0x72,0x69,0x74,0x65,0x64,0x20,
    0x43,0x41,0x30,0x81,0x92,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x01,
    0x03,0x81,0x84,0x00,0x02,0x81,0x80,0x74,0x2F,0x4F,0x75,0xD0,0x81,0x57,0x23,0x6F,
    0x2D,0x66,0x63,0x90,0xD1,0x42,0x20,0xCB,0x43,0x9F,0x4E,0xE2,0xF5,0x3A,0x14,0xD2,
    0xD8,0xC7,0xEA,0xDD,0xF3,0xB2,0x1E,0x81,0x9A,0x61,0x10,0x40,0x09,0xB2,0x7A,0x51,
    0xF3,0x66,0xF9,0x36,0x23,0x70,0x54,0xE8,0xE9,0x66,0x7A,0x94,0xA5,0xB1,0xF4,0x1B,
    0x31,0x18,0x56,0x5D,0xBF,0x8A,0x19,0x16,0x47,0x91,0x60,0xAA,0xF9,0x8D,0x45,0x5C,
    0x02,0x4B,0x7F,0x67,0xB3,0x02,0xF6,0x8F,0x6D,0x14,0xB9,0xCD,0x64,0x90,0xDD,0x0C,
    0x88,0xC7,0xC4,0x4B,0x12,0xD1,0xB8,0xBE,0x32,0xA0,0x9F,0xB9,0x4A,0x84,0x33,0xC3,
    0xAB,0xB6,0x42,0x4B,0x4B,0x32,0xED,0x29,0x3D,0x07,0xF8,0x07,0x7E,0xA2,0xF7,0xD8,
    0xA2,0x56,0x53,0x71,0x2A,0x53,0x7B,0xA3,0x7C,0x30,0x7A,0x30,0x1F,0x06,0x03,0x55,
    0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x8F,0x90,0xC6,0x8C,0x74,0xE8,0x7B,0x0C,
    0xC8,0x59,0xC7,0x7D,0x3C,0x5B,0x54,0x59,0x60,0x25,0x0B,0xB1,0x30,0x1D,0x06,0x03,
    0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x65,0x81,0x9F,0x70,0x3A,0x8C,0xAD,0xF6,0x43,
    0x1D,0xC8,0xE7,0x8F,0x55,0x8E,0xE8,0x4B,0xDB,0x87,0xE2,0x30,0x0E,0x06,0x03,0x55,
    0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x17,0x06,0x03,0x55,
    0x1D,0x20,0x04,0x10,0x30,0x0E,0x30,0x0C,0x06,0x0A,0x60,0x86,0x48,0x01,0x65,0x03,
    0x02,0x01,0x30,0x01,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,
    0x30,0x03,0x01,0x01,0xFF,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,
    0x03,0x30,0x00,0x30,0x2D,0x02,0x14,0x47,0xF0,0x98,0xC9,0xBB,0x05,0xA9,0x82,0xC5,
    0x11,0x2B,0x7A,0x5F,0xC9,0x11,0xE5,0x83,0x90,0xB7,0xD9,0x02,0x15,0x00,0x93,0xE1,
    0x0B,0xBE,0xAD,0x25,0x08,0x00,0x07,0x88,0x70,0xDF,0xC3,0x59,0x4F,0x22,0x9C,0xEA,
    0xD4,0x0F,
};

static const UInt8 RSAPSS_SHA256[] = {
    0x30,0x82,0x04,0x51,0x30,0x82,0x03,0x05,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x7B,
    0x20,0x9C,0x9D,0xDF,0x9C,0xED,0x93,0x43,0x73,0x51,0x0D,0x1B,0xD2,0x8A,0xDC,0x30,
    0x41,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0A,0x30,0x34,0xA0,0x0F,
    0x30,0x0D,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0xA1,
    0x1C,0x30,0x1A,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x08,0x30,0x0D,
    0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0xA2,0x03,0x02,
    0x01,0x20,0x30,0x31,0x31,0x2F,0x30,0x2D,0x06,0x03,0x55,0x04,0x03,0x13,0x26,0x54,
    0x75,0x63,0x73,0x6F,0x6E,0x20,0x55,0x6E,0x69,0x66,0x69,0x65,0x64,0x20,0x53,0x63,
    0x68,0x6F,0x6F,0x6C,0x20,0x44,0x69,0x73,0x74,0x72,0x69,0x63,0x74,0x20,0x52,0x6F,
    0x6F,0x74,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,0x31,0x34,0x30,0x39,0x30,0x32,0x30,
    0x37,0x31,0x36,0x32,0x39,0x5A,0x17,0x0D,0x33,0x34,0x30,0x39,0x30,0x32,0x30,0x37,
    0x32,0x38,0x33,0x33,0x5A,0x30,0x31,0x31,0x2F,0x30,0x2D,0x06,0x03,0x55,0x04,0x03,
    0x13,0x26,0x54,0x75,0x63,0x73,0x6F,0x6E,0x20,0x55,0x6E,0x69,0x66,0x69,0x65,0x64,
    0x20,0x53,0x63,0x68,0x6F,0x6F,0x6C,0x20,0x44,0x69,0x73,0x74,0x72,0x69,0x63,0x74,
    0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x41,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,
    0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,
    0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xC7,0x5F,0x0B,0x3D,0x69,0x0B,0x4F,
    0x05,0x0A,0xD9,0x2F,0xFC,0x06,0xD7,0x7E,0x16,0xD2,0x36,0x9E,0x97,0x24,0x4A,0x1B,
    0xCE,0x8E,0x39,0xE6,0x4E,0x2F,0xF3,0x42,0x52,0x61,0x35,0x5F,0x97,0xD5,0x3C,0x06,
    0x85,0x2E,0x39,0xD2,0xE9,0x4D,0x5C,0xEA,0xB9,0xE7,0x04,0x22,0x40,0xE1,0x30,0x61,
    0xD6,0xCC,0x4C,0x0F,0x3B,0xE5,0x25,0x3B,0x21,0x33,0xB7,0x5F,0xA6,0x33,0xC0,0x08,
    0x18,0xD9,0x4A,0xF7,0xC8,0x1C,0xEE,0x16,0xF5,0x7C,0xB1,0xBF,0x9A,0x01,0x7E,0x21,
    0x9F,0x0A,0xD7,0xAC,0x63,0xBA,0xA8,0x9B,0x21,0x64,0x6F,0x2B,0x42,0xFA,0x97,0x8B,
    0xCC,0xF9,0x04,0x91,0x79,0xE1,0xB9,0xFA,0xC2,0xBD,0x2F,0x54,0x02,0x67,0xB1,0xDF,
    0xB8,0x78,0x76,0x06,0x2B,0xC4,0x2E,0xBA,0x62,0xDB,0x70,0x49,0x59,0x8A,0x64,0xD0,
    0x71,0xCC,0x60,0x1F,0xC4,0x89,0xE7,0xE2,0x95,0x05,0x39,0x88,0x43,0x21,0x45,0xAE,
    0x80,0x72,0x2C,0xF6,0x70,0xE1,0xA6,0x65,0x52,0x4F,0x67,0x18,0x7C,0x80,0x4F,0xD3,
    0xE1,0x6C,0x39,0xAB,0x58,0x6F,0x4A,0x7B,0xB1,0xFB,0x21,0xF5,0xF6,0x26,0xCB,0x15,
    0x22,0xEF,0x63,0x1E,0x0E,0xBF,0x92,0xB2,0x3D,0x52,0x79,0xBC,0xE9,0xFE,0x62,0x18,
    0x83,0x0A,0x1D,0x97,0xF0,0x8E,0xE9,0x11,0x77,0x8F,0xDF,0xE5,0x0B,0xB8,0x0D,0xDB,
    0x6B,0x27,0x21,0xE0,0x12,0xB9,0xF4,0xB5,0xA2,0xD9,0x80,0xF4,0x64,0x66,0x5C,0x61,
    0xB6,0x16,0xC8,0x21,0x8B,0xDC,0x66,0x4F,0xEE,0x22,0x7F,0x07,0xA8,0x19,0x05,0x9E,
    0x83,0x0F,0x1E,0xC1,0x93,0x58,0x6C,0xEF,0xB3,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,
    0xFC,0x30,0x81,0xF9,0x30,0x0B,0x06,0x03,0x55,0x1D,0x0F,0x04,0x04,0x03,0x02,0x01,
    0x86,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,
    0x01,0xFF,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xFC,0xEE,0x66,
    0x3B,0xB0,0xC7,0xD4,0x6F,0x68,0x37,0xBA,0x99,0x27,0x73,0xEE,0x4F,0x8D,0x9B,0xE3,
    0xF4,0x30,0x10,0x06,0x09,0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x15,0x01,0x04,0x03,
    0x02,0x01,0x01,0x30,0x81,0x82,0x06,0x03,0x55,0x1D,0x20,0x04,0x7B,0x30,0x79,0x30,
    0x77,0x06,0x08,0x2A,0x03,0x04,0x8B,0x2F,0x43,0x59,0x05,0x30,0x6B,0x30,0x3A,0x06,
    0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x02,0x02,0x30,0x2E,0x1E,0x2C,0x00,0x4C,0x00,
    0x65,0x00,0x67,0x00,0x61,0x00,0x6C,0x00,0x20,0x00,0x50,0x00,0x6F,0x00,0x6C,0x00,
    0x69,0x00,0x63,0x00,0x79,0x00,0x20,0x00,0x53,0x00,0x74,0x00,0x61,0x00,0x74,0x00,
    0x65,0x00,0x6D,0x00,0x65,0x00,0x6E,0x00,0x74,0x30,0x2D,0x06,0x08,0x2B,0x06,0x01,
    0x05,0x05,0x07,0x02,0x01,0x16,0x21,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,
    0x6C,0x2E,0x74,0x75,0x73,0x64,0x31,0x2E,0x6F,0x72,0x67,0x2F,0x70,0x6B,0x69,0x2F,
    0x63,0x70,0x73,0x2E,0x74,0x78,0x74,0x00,0x30,0x23,0x06,0x09,0x2B,0x06,0x01,0x04,
    0x01,0x82,0x37,0x15,0x02,0x04,0x16,0x04,0x14,0x10,0xF3,0x7D,0x95,0x8D,0xB7,0x2F,
    0x44,0x17,0xD7,0xED,0x56,0xC3,0x7E,0x64,0xAA,0x4F,0xEF,0x26,0xEA,0x30,0x41,0x06,
    0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0A,0x30,0x34,0xA0,0x0F,0x30,0x0D,
    0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0xA1,0x1C,0x30,
    0x1A,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x08,0x30,0x0D,0x06,0x09,
    0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0xA2,0x03,0x02,0x01,0x20,
    0x03,0x82,0x01,0x01,0x00,0x03,0x1F,0xF8,0x3C,0x15,0x37,0xA7,0xBB,0xB1,0x6A,0x27,
    0xDB,0x27,0x7F,0xF8,0x23,0xAD,0x51,0xEE,0x87,0x61,0xC8,0xAB,0x56,0x83,0x1C,0x11,
    0xA9,0xAC,0x79,0xB4,0x7E,0x2E,0x33,0x3F,0xBD,0x98,0x7B,0xE4,0x28,0xAB,0xB1,0xCB,
    0x00,0xEE,0xB3,0x2D,0x6B,0x8D,0x15,0xAD,0x4B,0x51,0x29,0xFE,0x05,0xE6,0x5C,0x1C,
    0xBA,0x70,0xAF,0x30,0x13,0x2C,0xAE,0xDD,0x8D,0x95,0xF5,0x56,0x13,0x2B,0x43,0x07,
    0x0F,0xC3,0xCB,0xDA,0x2B,0x46,0x44,0x8E,0x12,0xE3,0x9E,0x14,0xE2,0x5E,0x74,0x07,
    0x0C,0x92,0xDE,0x99,0x45,0x37,0x51,0xFB,0xDB,0x75,0xFE,0x16,0x37,0x58,0x05,0xB3,
    0xDE,0x3E,0xD1,0x77,0x57,0x6A,0x56,0xF1,0xF6,0xC1,0x9F,0xA8,0x93,0xCF,0xA8,0x67,
    0x32,0xE1,0xDB,0x65,0x12,0x39,0x76,0x91,0xB7,0x85,0xDD,0xF0,0x30,0xEF,0x6E,0x68,
    0x41,0xCD,0x72,0x0B,0x8D,0x85,0x50,0x26,0xC1,0x0B,0x93,0x2B,0x9F,0x07,0x44,0x57,
    0x84,0x55,0x3F,0x28,0x75,0x05,0x12,0x04,0x58,0x27,0x24,0x5D,0x21,0x68,0xB5,0xF4,
    0xB9,0xFA,0xE6,0xC1,0xCB,0x99,0x7C,0x85,0x45,0x01,0xFE,0x43,0x8C,0xCA,0x9E,0x44,
    0x32,0x46,0x23,0xFC,0xBD,0x2D,0xCA,0x19,0xF8,0xDB,0x1C,0x9F,0x85,0x3D,0x7C,0xAA,
    0xCC,0x42,0x16,0x4D,0x61,0x7D,0xA1,0x67,0xD5,0xC0,0x25,0x62,0xDB,0xE2,0x61,0xB0,
    0xDD,0xB6,0xD6,0x07,0x03,0x1B,0xD0,0x0E,0xB2,0xBA,0xC2,0xBF,0x24,0x7C,0x2B,0x82,
    0xEB,0xEE,0xB0,0x29,0xE5,0x8E,0xDD,0x55,0xF6,0x3B,0x5E,0x46,0x0D,0xCE,0x55,0xEA,
    0x70,0x2F,0xFF,0xF8,0x74,
};

static void test_signature_hash_algorithm()
{
    SecCertificateRef cert=NULL;
    SecSignatureHashAlgorithm alg=0;
    
    isnt(cert = SecCertificateCreateWithBytes(NULL, RSA_MD2, sizeof(RSA_MD2)),
         NULL, "create RSA_MD2");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmMD2, "expected kSecSignatureHashAlgorithmMD2 (got %d)", (int)alg);
    CFReleaseNull(cert);

    isnt(cert = SecCertificateCreateWithBytes(NULL, RSA_MD5, sizeof(RSA_MD5)),
         NULL, "create RSA_MD5");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmMD5, "expected kSecSignatureHashAlgorithmMD5 (got %d)", (int)alg);
    CFReleaseNull(cert);

    isnt(cert = SecCertificateCreateWithBytes(NULL, RSA_SHA1, sizeof(RSA_SHA1)),
         NULL, "create RSA_SHA1");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmSHA1, "expected kSecSignatureHashAlgorithmSHA1 (got %d)", (int)alg);
    CFReleaseNull(cert);

    isnt(cert = SecCertificateCreateWithBytes(NULL, RSA_SHA256, sizeof(RSA_SHA256)),
         NULL, "create RSA_SHA256");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmSHA256, "expected kSecSignatureHashAlgorithmSHA256 (got %d)", (int)alg);
    CFReleaseNull(cert);

    isnt(cert = SecCertificateCreateWithBytes(NULL, RSA_SHA512, sizeof(RSA_SHA512)),
         NULL, "create RSA_SHA512");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmSHA512, "expected kSecSignatureHashAlgorithmSHA512 (got %d)", (int)alg);
    CFReleaseNull(cert);

    isnt(cert = SecCertificateCreateWithBytes(NULL, DSA_SHA1, sizeof(DSA_SHA1)),
         NULL, "create DSA_SHA1");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmSHA1, "expected kSecSignatureHashAlgorithmSHA1 (got %d)", (int)alg);
    CFReleaseNull(cert);

    isnt(cert = SecCertificateCreateWithBytes(NULL, ECDSA_SHA1, sizeof(ECDSA_SHA1)),
         NULL, "create ECDSA_SHA1");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmSHA1, "expected kSecSignatureHashAlgorithmSHA1 (got %d)", (int)alg);
    CFReleaseNull(cert);

    isnt(cert = SecCertificateCreateWithBytes(NULL, ECDSA_SHA256, sizeof(ECDSA_SHA256)),
         NULL, "create ECDSA_SHA256");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmSHA256, "expected kSecSignatureHashAlgorithmSHA256 (got %d)", (int)alg);
    CFReleaseNull(cert);

    isnt(cert = SecCertificateCreateWithBytes(NULL, ECDSA_SHA384, sizeof(ECDSA_SHA384)),
         NULL, "create ECDSA_SHA384");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmSHA384, "expected kSecSignatureHashAlgorithmSHA384 (got %d)", (int)alg);
    CFReleaseNull(cert);

    /* %%% RSAPSS is not yet supported; change this test when it is. <rdar://19356971> */
    isnt(cert = SecCertificateCreateWithBytes(NULL, RSAPSS_SHA256, sizeof(RSAPSS_SHA256)),
         NULL, "create RSAPSS_SHA256");
    alg = SecCertificateGetSignatureHashAlgorithm(cert);
    ok(alg == kSecSignatureHashAlgorithmUnknown, "expected kSecSignatureHashAlgorithmUnknown (got %d)", (int)alg);
    CFReleaseNull(cert);

}

static void tests(void)
{
    test_signature_hash_algorithm();
}

int si_83_seccertificate_sighashalg(int argc, char *const *argv)
{
	plan_tests(20);

	tests();

	return 0;
}
